class LinkNode{
    constructor(val){
         this.val=val;
         this.next=null
    }
    append(val){
        let cur=this;
        while(cur.next!==null){
            cur=cur.next
        }
        cur.next=val
    }
}
const testLinkNode=new LinkNode(1)
const childLinkNode=new LinkNode(2)
const childLinkNode2=new LinkNode(3)
const childLinkNode3=new LinkNode(4)
testLinkNode.append(childLinkNode)
function reverse(pre,cur){
    if(!cur)return pre
    let next=cur.next;
    cur.next=pre
    pre=cur
    reverse(cur,next)
    
}
function reverseList(head){
    return reverse(null,head)
}